#ifndef SYSTEMSDL_1_2_H
#define SYSTEMSDL_1_2_H


//
//  FORWARD DECLS
//
struct SDL_Surface;
union SDL_Event;
struct SDL_RWops;
struct SDL_VideoInfo;
class CMain;
class CMainWindowSDL_1_2;
class CPoint;
class CColor;

#include <cstdio>

typedef class CSystemSDL_1_2
{
    public:
        //
        //  PUBLIC METHODS
        //
static  int Run( CMain& engine );
static  void Sleep( unsigned int ms );
    private:
        //
        //  CTORS and DTORS unimplemented for a good reason
        //
        CSystemSDL_1_2( void );
        CSystemSDL_1_2( const CSystemSDL_1_2& sys );
        CSystemSDL_1_2 operator=( const CSystemSDL_1_2& sys );
        ~CSystemSDL_1_2( void );

        //
        //  PRIVATE METHODS
        //
static  int Init( void );
static  void ShutDown( void );

        //
        //  PRIVATE MEMBERS
        //
static  CMainWindowSDL_1_2* m_pMainWnd;

        //  FRIENDS OF CSystemSDL_1_2
friend  class CMain;
} CSystem;

class CSystemSDL_1_2_Video
{
        //
        //  CTORS  DTORS unimplemented for a really good reason
        //
        CSystemSDL_1_2_Video( void );
        CSystemSDL_1_2_Video( const CSystemSDL_1_2_Video& vid );
        CSystemSDL_1_2_Video operator=( const CSystemSDL_1_2_Video& vid );
        ~CSystemSDL_1_2_Video( void );

        //
        //  PRIVATE METHODS
        //
static  int Init( void );
static  int Process( void );
static  void ShutDown( void );

static  void PrintVidInfo( void );

        //
        //  PRIVATE MEMBERS
        //
static  bool                    m_isRunning;
static  SDL_Surface*            m_pFocusWnd;
static  const SDL_VideoInfo*    m_pVideoInfo;

        // FRIENDS OF CSystemSDL_1_2_Video
friend  class CSystemSDL_1_2;
};

typedef class CSystemSDL_1_2_Renderer
{
        //
        //  CTORS  DTORS unimplemented for a really good reason
        //
        CSystemSDL_1_2_Renderer( void );
        CSystemSDL_1_2_Renderer( const CSystemSDL_1_2_Renderer& rend );
        CSystemSDL_1_2_Renderer operator=( const CSystemSDL_1_2_Renderer& rend );
        ~CSystemSDL_1_2_Renderer( void );

        //  PUBLIC METHODS
        public:
static  int DrawPoint( const CPoint& pt, const CColor& color );
static  int DrawPoint( const CPoint& pt );
static  int DrawPoints( const CPoint* ppts, const CColor& color );
static  int DrawPoints( const CPoint* ppts );
static  int NDrawLine( const CPoint& begin, const CPoint& end, const CColor& color );
static  int DrawLine( const CPoint& begin, const CPoint& end, const CColor& color );
static  int DrawLine( const CPoint& begin, const CPoint& end );
static  int DrawLines( const CPoint* ppts, const CColor& color );
static  int DrawLines( const CPoint* ppts );

        private:
        //  PRIVATE METHODS
static  int Init( void );
static  void ShutDown( void );
        //  PRIVATE MEMBERS
static  SDL_Surface* m_pCurrentContext;
        //  FRIENDS OF CSystemSDL_1_2_Renderer
friend  class CSystemSDL_1_2;
} CSystemRenderer;

class CSystemSDL_1_2_Helper
{
    //
    //  CTORS and DTORS not implemented for a reason
    //
    CSystemSDL_1_2_Helper( void );
    CSystemSDL_1_2_Helper( const CSystemSDL_1_2_Helper& hlp );
    CSystemSDL_1_2_Helper operator=( const CSystemSDL_1_2_Helper& hlp );
    ~CSystemSDL_1_2_Helper( void );

    //
    //  PRIVATE METHODS
    //
static  int  Init( void );
static  void ShutDown( void );
static  void Printf( const char* data, ... );   // prints to the standard output
static  void PrintEvent( const SDL_Event& ev );
static  void PrintSurface( const SDL_Surface* surf );
static  void PrintFlag( unsigned int flag );
static  void PrintMouseFlag( unsigned int flag );

    //
    //  PRIVATE MEMBERS
    //
    enum printFlags
    {
        PF_CONSOLE = 1,
        PF_FILE,
        PF_ALL
    } printFlags;

static  unsigned int    m_DebugPrint;
static  SDL_RWops*      m_pDataFile;

    //
    //  FRIENDS of class CSystemSDL_1_2_Helper
    //
friend  class CSystemSDL_1_2;
friend  class CSystemSDL_1_2_Video;
friend  class CSystemSDL_1_2_Renderer;
};

#endif // SYSTEMSDL_1_2_H
